package com.shareinfo.base.controller.plug;

import java.util.ArrayList;
import java.util.List;

import com.shareinfo.base.model.plug.EasyUIModel;

/**
 * easyui所需的转换
 * @author Administrator
 *
 */
public class EasyUIPlug {
	/**
	 * 属性迭代，需要model对象存在getId和getPid方法
	 */
	public static List treeListBuilder(String root,List list){
			List orderList=new ArrayList();
			EasyUIModel model=null;
			for (int i = 0; list!=null && i < list.size(); i++) {
				model=(EasyUIModel)list.get(i);
				if(root.equals(model.getPid())){
					model.setChildren(treeListBuilder(model.getId(),list));
					orderList.add(model);
				}
			}
			return orderList;
		}
}
